package com.yangfan.thread.thread_wangwenjun03;

/**
 * @description: 死锁
 * @author: yangfan
 * @date: Created in 2020/1/26 0026 19:10
 * @modified By:
 */
public class DeadLockService {


    private final Object lock = new Object();

    private DeadLock deadLock;


    public void setDeadLock(DeadLock deadLock){
        this.deadLock = deadLock;
    }

    public void s1(){

        synchronized (lock){//先给自己加锁

            System.out.println("================s1================");
        }

    }


    public void s2(){

        synchronized (lock){//先给自己加锁

            deadLock.m2();

        }

    }






}
